<?php
/**
 * Minhlog Domain_Mapper 页面类
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   Domain
 * @package    Domain_DataMapper
 * @copyright  Copyright (c) 2009-2010 Minh.Shu@gmail.com
 * @license    New BSD License
 * @author     Minh.Shu
 * @version    $Id: Page.php 2 2010-01-17 13:49:08Z Minh.Shu $
 *
 */

class Domain_DataMapper_Page extends Domain_DataMapper_Abstract
{
    protected $_tableClassName = 'Domain_Table_Page';

    protected $_dataMapper = array (
            'pageId'      => 'page_id',
            'pageTitle'   => 'page_title',
            'pageContent' => 'page_content',
            'publishTime' => 'publish_time'
    );

    /**
     * 查询全部页面
     * @return object|void
     */
    public function findAllPage()
    {
        return $this->findAll($this->findAllPageStatement());
    }

    /**
     * 封装查询全部页面SQL对象
     * @return Zend_Db_Table_Select
     */
    private function findAllPageStatement()
    {
        $select = $this->getTable()->select();
        $select->order('publish_time DESC');
        return $select;
    }
}